You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@atlaskit/icon

Package Overview
Dependencies
Maintainers
1
Versions
253
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/icon

A React package that contains icons


Version published
Weekly downloads
123K
decreased by-16.31%
Maintainers
1
Install size
9.84 MB
Created
Weekly downloads
 

Package description

What is @atlaskit/icon?

@atlaskit/icon is a package from Atlassian's Atlaskit design system that provides a collection of icons for use in React applications. It offers a variety of icons that can be easily integrated and customized within your projects.

What are @atlaskit/icon's main functionalities?

Basic Icon Usage

This feature allows you to import and use a specific icon from the @atlaskit/icon package. The example demonstrates how to use the AtlassianIcon with a medium size.

import { AtlassianIcon } from '@atlaskit/icon';

const MyComponent = () => (
  <div>
    <AtlassianIcon size="medium" />
  </div>
);

Customizing Icon Size

This feature allows you to customize the size of the icon. The example shows how to set the size of the AtlassianIcon to large.

import { AtlassianIcon } from '@atlaskit/icon';

const MyComponent = () => (
  <div>
    <AtlassianIcon size="large" />
  </div>
);

Using Different Icons

This feature demonstrates how to use different icons from the @atlaskit/icon package. The example shows the usage of BitbucketIcon and JiraIcon with medium size.

import { BitbucketIcon, JiraIcon } from '@atlaskit/icon';

const MyComponent = () => (
  <div>
    <BitbucketIcon size="medium" />
    <JiraIcon size="medium" />
  </div>
);

Other packages similar to @atlaskit/icon

Readme

Source

BEFORE YOU CHANGE ICONS

!!IMPORTANT

The icons package has a custom build process, as it generates its both stripped svgs and glyphs that are committed to the repo, so that they can be accessed as paths when published.

You will manually need to run yarn build:icon from the root repository, or yarn build from inside the icon folder whenever you make changes to icon.

Icon

This package contains the Atlaskit icons. All icons should be consumed separately unless your build tool supports tree shaking.

This packages is licensed under the Atlassian Design Guidelines - please check the LICENSE file for more information.

Installation

npm install @atlaskit/icon

Using the component

HTML

The @atlaskit/icon package exports the Icon React components.

Import the component in your React app as follows:

bundle.js
import AkIconHome from '@atlaskit/icon/glyph/home';
ReactDOM.render(<AkIconHome />, container);

Controlling the icon color

You can control the icon color via CSS:

<span style={{color: 'red'}}>
  <AkIconHome />
</span>

Use the bundle (all icons)

This package provides all icons bundled in one export but unless your build tool supports tree shaking, you should import only a single icon instead of the bundled version.

bundle.js

import * as icons from '@atlaskit/icon';
const { BitbucketLogo } = icons;

ReactDOM.render(<BitbucketLogo />, container);

Importing a single icon (this will still bundle all of the icons in your final bundle if you don't use tree shaking):

import BitbucketLogo from '@atlaskit/icon';

ReactDOM.render(<BitbucketLogo />, container);

Adding new icons

Adding new icons is as simple as checking out the Atlaskit repo, adding your SVG file to /packages/core/icon/utils/raw_svgs and running yarn update from within the packages/core/icon directory.

NOTE: The reduced-ui-pack package should contain all the icons we include in this package. Make sure to rebuild the reduced-ui-pack sprite as outlined in the README.md file included within that package.

Some things to look for:

  • If your icon is used only in a specific context or product, place it in /icon/src/icons/subfolder and it will be namespaced appropriately.
  • Check that the icon appears in the All icons story. Look for any clipping or sizing issues here.
  • Check the All icons (usage) story to make sure the naming has worked as expected (paths/namespacing makes sense, etc).
  • Check the Icons with broken fills (solid parts) story to make sure that no parts of your svg have hardcoded colors.
    • If any parts of your icon appear to be dark, check the svg file for instances of fill="XXXXX" and replace them with fill="currentColor".
  • Check the Icons that are too big (red parts) story to show any parts of the icon that fall outside the 24x24 size that icons should fill.
  • Make sure you update the test in icon/test/indexSpec.jsx to include your icon.
  • Make sure you use the appropriate commit message when adding or modifying icons
    • changing an icon is a patch
    • adding an icon is a feature
    • removing an icon is breaking change
    • renaming an icon is a breaking change

Classes

Icon

Icon

Kind: global class

new Icon()

Icon interface. All icons follow this structure.

icon.label :

string

(Required) The icon label This is a required attribute. Omitting it will make the icon inaccessible for screen readers, etc.. The text passed will be sanitized, e.g. passed HTML will be represented as plain text.

Kind: instance property of Icon

icon.size :

size

(Optional) An icon size.

Defaults to an empty string (which means it uses the default size).

Kind: instance property of Icon Default: small

icon.onClick :

function

(Optional) A handler to execute when the icon is clicked.

Defaults to a noop.

Kind: instance property of Icon

size :

enum

Icon size values.

Kind: global enum Properties

NameTypeDefaultDescription
smallstring"small"small icon
mediumstring"medium"medium icon
largestring"large"large icon
xlargestring"xlarge"xlarge icon

Keywords

FAQs

Package last updated on 15 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc